# gen circle mask for circle select
import numpy as np


def get_circle_mask(mat_len):
    # rad could be even or odd, but the mask should be equal to 2*rad, even mask is not a standard circle
    mask = np.zeros([mat_len, mat_len])
    rad = int(mat_len / 2)
    r = c = mat_len / 2
    for idxi in range(mat_len):
        for idxj in range(mat_len):
            delta_x = r - idxi
            delta_y = c - idxj
            if (delta_x**2 + delta_y**2)**0.5 <= rad:
                mask[idxi, idxj] = 1
    return mask
